<template>
    <el-button type="text" @click="onClick">{{ label }}</el-button>
</template>

<script lang="ts">
import { Vue, Component, Prop, Inject } from 'vue-property-decorator';
import KTableActions from '@/components/table-actions/index.vue';

@Component({ name: 'KTableActionItem' })
export default class KTableActionItem extends Vue {
    @Prop({ type: String }) readonly label!: string;
    @Prop({ type: String }) readonly command!: string;
    @Inject() readonly actions!: KTableActions;

    mounted() {
        this.actions.$emit('k-table-bind:add', this);
        // this.$emit('k-table-bind:add', this);
    }

    onClick() {
        this.actions.$emit('k-table-bind:click', this);
    }
}
</script>
